package se.ramfelt.psnfriends.model;

import se.ramfelt.psn.model.TrophySummary;
import android.os.Parcel;
import android.os.Parcelable;

public class ParcelableTrophySummary implements Parcelable {

    private final TrophySummary trophySummary;

    public ParcelableTrophySummary(TrophySummary trophies) {
        this.trophySummary = trophies;
    }

    public ParcelableTrophySummary(Parcel in) {
        this.trophySummary = new TrophySummary();
        trophySummary.setLevel(in.readInt());
        trophySummary.setPlatinum(in.readInt());
        trophySummary.setGold(in.readInt());
        trophySummary.setSilver(in.readInt());
        trophySummary.setBronze(in.readInt());
    }

    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(trophySummary.getLevel());
        dest.writeInt(trophySummary.getPlatinum());
        dest.writeInt(trophySummary.getGold());
        dest.writeInt(trophySummary.getSilver());
        dest.writeInt(trophySummary.getBronze());
    }

    public int describeContents() {
        return 0;
    }

    public TrophySummary getTrophySummary() {
        return trophySummary;
    }

    public static final Parcelable.Creator<ParcelableTrophySummary> CREATOR = new Parcelable.Creator<ParcelableTrophySummary>() {
        public ParcelableTrophySummary createFromParcel(Parcel in) {
            return new ParcelableTrophySummary(in);
        }

        public ParcelableTrophySummary[] newArray(int size) {
            return new ParcelableTrophySummary[size];
        }
    };
}
